import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/models/xindong_file_select_class.dart';
import 'package:xindong/res/assets_res.dart';
import 'package:xindong/routes/user/auth/xindong_auth_ctr.dart';
import 'package:xindong/utils/xindong_image_util.dart';
import 'package:xindong/widgets/common/xindong_app_bar.dart';
import 'package:xindong/widgets/common/xindong_button.dart';
import 'package:xindong/widgets/image/xindong_media_add_container.dart';

class XinDongAuthEducationYeMian extends StatefulWidget {
  const XinDongAuthEducationYeMian({super.key});

  @override
  State<XinDongAuthEducationYeMian> createState() => _XinDongAuthEducationYeMianState();
}

class _XinDongAuthEducationYeMianState extends State<XinDongAuthEducationYeMian> {
  List<XinDongSelectFileClass> fileClasss = [];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: XinDongAppBar("学历认证"),
      body: Stack(
        children: [
          ListView(
            padding: const EdgeInsets.all(kPaddingValue),
            children: [
              const Text(
                "请按以下要求上传学历证明",
                style: TextStyle(color: DZColors.titleColor, fontSize: 15),
              ),
              Padding(
                padding: const EdgeInsets.only(top: 16.0, bottom: 16.0),
                child: AspectRatio(
                  aspectRatio: 351 / 218.0,
                  child: ImageUtil.asset(AssetsRes.IMAGE_AUTH_EDUCATION, fit: BoxFit.cover),
                ),
              ),
              // <div class="tip-wrap">
              // <p class="title">{{_i18n('说明')}}：</p>
              // <p class="text">{{_i18n('应当提交以下文件之一')}}：</p>
              // <p class="text">&nbsp;&nbsp;(1){{_i18n('国内的毕业证')}}</p>
              // <p class="text">&nbsp;&nbsp;(2){{_i18n('国内的学位证书')}}</p>
              // <p class="text">&nbsp;&nbsp;(3){{_i18n('毕业证明书')}}({{_i18n('毕业证书丢失的可由毕业院校开具证明')}})</p>
              // <p class="text">&nbsp;&nbsp;(4){{_i18n('学信网的在线认证报告')}}({{_i18n('有二维码')}})</p>
              // <p class="text">&nbsp;&nbsp;(5){{_i18n('教育部留学服务中心颁发的国外学历学位认证书')}}</p>
              // </div>
              Container(
                padding: const EdgeInsets.all(10),
                margin: const EdgeInsets.only(bottom: 16.0),
                decoration: BoxDecoration(color: DZColors.cellColor, borderRadius: BorderRadius.circular(16)),
                child: const Text.rich(
                  TextSpan(
                    text: "说明：\n",
                    style: TextStyle(color: DZColors.titleColor, fontSize: 16, fontWeight: FontWeight.w500),
                    children: [
                      TextSpan(
                        text: "应当提交以下文件之一\n",
                        style: TextStyle(color: DZColors.contentColor, fontSize: 14, height: 2.0),
                        children: [
                          TextSpan(text: "\t(1)国内的毕业证\n"),
                          TextSpan(text: "\t(2)国内的学位证书\n"),
                          TextSpan(text: "\t(3)毕业证明书(毕业证书丢失的可由毕业院校开具证明)\n"),
                          TextSpan(text: "\t(4)学信网的在线认证报告(有二维码)\n"),
                          TextSpan(text: "\t(5)教育部留学服务中心颁发的国外学历学位认证书"),
                        ],
                      ),
                    ],
                  ),
                ),
              ),
              const Text(
                "相关证件图片（正反2面）",
                style: TextStyle(color: DZColors.titleColor, fontSize: 15),
              ),
              SizedBox(
                child: Container(
                  alignment: Alignment.topLeft,
                  constraints: const BoxConstraints(maxWidth: 300),
                  padding: const EdgeInsets.only(top: 16.0, bottom: 16.0),
                  child: XinDongMediaAddContainer(
                    maxCount: 2,
                    supportType: MediaSupportType.onlyImage,
                    onSelect: (images, video) {
                      fileClasss = images!;
                    },
                  ),
                ),
              ),
              SizedBox(height: 25 + kButtonHeight + bottomBarHeight + 30),
            ],
          ),
          Positioned(
            bottom: 30 + bottomBarHeight,
            left: 16,
            right: 16,
            child: SizedBox(
              height: kButtonHeight,
              child: XinDongCommonButton(
                '提交',
                onTap: () => XinDongAuthCtr.to.requestAuthEducation(fileClasss: fileClasss),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
